package com.lianxian.xindong.me.di.module;

import android.view.View;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.hxb.library.base.DefaultAdapter;
import com.hxb.library.di.scope.FragmentScope;

import dagger.Binds;
import dagger.Module;
import dagger.Provides;

import com.hxb.library.utils.AntiShakeUtils;
import com.lianxian.xindong.me.mvp.contract.WorksSelfieContract;
import com.lianxian.xindong.me.mvp.model.WorksSelfieModel;
import com.lianxian.xindong.me.mvp.ui.adapter.WorkDataAdapter;

import java.util.ArrayList;
import java.util.List;


/**
 * @作者：hexingbo
 * @时间：07/07/2023
 * @描述：
 */
@Module
public abstract class WorksSelfieModule {

    @Binds
    abstract WorksSelfieContract.Model bindFriendSelfieWorksModel(WorksSelfieModel model);

    @FragmentScope
    @Provides
    static RecyclerView.LayoutManager provideLayoutManager(WorksSelfieContract.View view) {
        return new GridLayoutManager(view.getContext(), 3);
    }

    @FragmentScope
    @Provides
    static List<Object> provideList() {
        return new ArrayList<>();
    }

    @FragmentScope
    @Provides
    static RecyclerView.Adapter provideAdapter(WorksSelfieContract.View view, List<Object> list) {
        WorkDataAdapter adapter = new WorkDataAdapter(list);
        adapter.setOnItemClickListener(new DefaultAdapter.OnRecyclerViewItemClickListener<Object>() {
            @Override
            public void onItemClick(View v, int viewType, Object data, int position) {
                if (AntiShakeUtils.isInvalidClick(v)) {
                    return;
                }


            }
        });
        return adapter;
    }
}